-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cover 'order filtration' scenarios in API #15566
Conversation
TheMilek
commented
Nov 28, 2023
Q | A |
---|---|
Branch? | 1.13 |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
License | MIT |
Bunnyshell Preview Environment deletedAvailable commands:
|
@@ -17,15 +17,15 @@ Feature: Filtering orders by products | |||
And the customer chose "Free" shipping method to "United States" with "Offline" payment | |||
And I am logged in as an administrator | |||
|
|||
@ui @javascript | |||
@ui @api @javascript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we establish a convention? In the system, we have three variations: @api @ui @javascript
, @ui @api @javascript
, and @ui @javascript @api
. I know it's not a problem of this PR.
if (str_contains($total, '.')) { | ||
$total = str_replace('.', '', $total); | ||
$this->client->addFilter('total[gt]', $total); | ||
|
||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest creating a private method that either removes .
or adds 00
. This method could be used here and method below.
<tag name="api_platform.filter" /> | ||
</service> | ||
|
||
<service id="sylius.api.order_product_filter" parent="api_platform.doctrine.orm.search_filter" public="true"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only a suggestion to connect all search_filter
for order
in one filter.
|
||
/** | ||
* @When I filter by product :productName | ||
* @When I filter by products :firstProduct and :secondProduct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @When I filter by products :firstProduct and :secondProduct | |
* @When I filter by products :firstProductName and :secondProductName |
* @When I filter by product :productName | ||
* @When I filter by products :firstProduct and :secondProduct | ||
*/ | ||
public function iFilterByProduct(string ...$productNames): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function iFilterByProduct(string ...$productNames): void | |
public function iFilterByProduct(string ...$productsNames): void |
|
||
/** | ||
* @When I filter by variant :variantName | ||
* @When I filter by variants :firstVariant and :secondVariant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @When I filter by variants :firstVariant and :secondVariant | |
* @When I filter by variants :firstVariantName and :secondVariantName |
/** | ||
* @Then I should not see an order with :orderNumber number | ||
*/ | ||
public function iShouldNotSeeOrderWithNumber(string $orderNumber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function iShouldNotSeeOrderWithNumber(string $orderNumber) | |
public function iShouldNotSeeOrderWithNumber(string $orderNumber): void |
Thanks, Kamil! 🎉 |